/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package net.tygzs.minerpg.CommandExecutor.MineItem;

import net.md_5.bungee.api.ChatColor;
import net.tygzs.minerpg.Configuration.Item.RPGItem;
import net.tygzs.minerpg.Main;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

/**
 *
 * @author thtTNT
 */
public class Command_DisPlay
{

    public static void ChangeDisPlay(CommandSender sender, String ItemName)
    {
        RPGItem ri = Main.getPluginConfig().getItem(ItemName);
        if (ri == null)
        {
            sender.sendMessage(ChatColor.RED + "物品不存在");
            return;
        }
        Player player = (Player) sender;
        ItemStack is = player.getItemInHand();
        if (is.getType() == Material.AIR)
        {
            sender.sendMessage(ChatColor.RED + "不能把空气设置成模型");
            return;
        }
        Main.getPluginConfig().getItem(ItemName).setDisPlayID(is.getTypeId());
        Main.getPluginConfig().getItem(ItemName).setDisPlayDur(is.getDurability());
        sender.sendMessage(ChatColor.GREEN + "模型设置成功");
    }
}
